// eslint.config.mjs
import globals from "globals";
import tseslint from "typescript-eslint";
import pluginVue from "eslint-plugin-vue";
import { defineConfig } from "eslint/config";

export default defineConfig([
  { files: ["**/*.js"], languageOptions: { sourceType: "script" } },
  { files: ["**/*.{js,mjs,cjs,ts,mts,cts,vue}"], languageOptions: { globals: globals.browser } },
  tseslint.configs.recommended,
  pluginVue.configs["flat/essential"],
  {
    files: ["**/*.vue"],
    languageOptions: { parserOptions: { parser: tseslint.parser } },
    // 关闭报错的规则
    rules: {
      // 关闭组件名必须多单词（解决 "about"、"index" 报错）
      "vue/multi-word-component-names": "off",
      // 关闭未使用变量检查（解决 RequestComp、gotoAlova 等未使用报错）
      "@typescript-eslint/no-unused-vars": "off",
      // 关闭模板解析错误（解决 unexpected-character-in-attribute-name 报错）
      "vue/no-parsing-error": "off"
    }
  },
]);
